<template>
	<view class="page f-center" style="background: #FFFFFF">
		<image style="height: 100%;width: 100%;" mode="aspectFill" src="../../static/images/index_image.png" @click="toHome"></image>
		<view style="position: absolute;bottom: 30rpx;right: 30rpx;height: 60rpx;width: 60rpx;border-radius: 30rpx;text-align: center;line-height: 60rpx;
					color: #FFFFFF;background-color: rgba(33,33,33,0.4);font-size: 26rpx;">{{time}}</view>
		<!-- 		<view class="content-container">
			<image src="../../static/icons/logo.png"></image>
			<view class="title">顺博商城商家版</view>
		</view> -->
	</view>
</template>

<script>
	let _this, i;
	export default {
		data() {
			return {
				time: 5,
			}
		},
		onLoad() {
			_this = this;
			i = setInterval(() => {
				_this.time -= 1;
			}, 1000);
		},
		watch: {
			time: function(newV) {
				if (newV == 1) {
					return new Promise((resolve, reject) => {
						clearInterval(i);
						resolve();
					}).then((res) => {
						setTimeout(() => {
							uni.redirectTo({
								url: '../login/login'
							});
						},1000)
					});
				}
			}
		},
		methods: {
			toHome() {
				return new Promise((resolve, reject) => {
					clearInterval(i);
					resolve();
				}).then((res) => {
					uni.redirectTo({
						url: '../login/login'
					});
				});
			}
		}
	}
</script>

<style>
	.content-container {
		display: flex;
		flex-direction: column;
		position: relative;
		justify-content: center;
	}

	.content-container image {
		height: 250rpx;
		width: 250rpx;
		border-radius: 30rpx;
	}

	.content-container .title {
		line-height: 100rpx;
		font-size: 32rpx;
		text-align: center;
		font-weight: bold;
	}
</style>
